package com.nstc.sftpExchange.config.sftp;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

@Slf4j
public class FtpTemplateRegistrar implements ImportBeanDefinitionRegistrar {
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,
                                        BeanDefinitionRegistry registry) {

        // 注册 FtpTemplateRegistrarProcessor 处理器
        BeanDefinitionBuilder processorBuilder = BeanDefinitionBuilder
                .genericBeanDefinition(FtpTemplateRegistrarProcessor.class);
        processorBuilder.setInitMethodName("registerFtpTemplates");
        registry.registerBeanDefinition("ftpTemplateRegistrarProcessor",processorBuilder.getBeanDefinition());
    }
}
